import type { InjectorType } from '../../lib/style_injector'
import type { ElementSelectorDOMScopeType } from '../../types/constants'

export interface ElementLocator {
  domScope: ElementSelectorDOMScopeType
  hostSelector?: string
  selector: string
}

/**
 * 元素隐藏配置接口
 */
export interface ElementHideConfig {
  enable: boolean
  domScope: ElementSelectorDOMScopeType
  hostSelector?: string
  selector: string
  hide: boolean
  listen: boolean
  useCssInjection: boolean
  handler?: () => void
}

/**
 * 元素隐藏操作类型枚举
 */
export enum ElementHideOperationType {
  Skip = 'skip',
  Static = 'static',
  Dynamic = 'dynamic',
  DynamicCancellation = 'dynamic-cancellation',
  EventDriven = 'event-driven',
}

/**
 * 元素隐藏 CSS 操作类型枚举
 */
export enum ElementHideCssOperation {
  Inject = 'inject',
  Remove = 'remove',
}

export enum ElementHideCssType {
  /**
   * 普通 DOM 环境
   */
  STANDARD_DOM = 'standard-dom',
  /**
   * Shadow DOM环境
   */
  SHADOW_DOM = 'shadow-root',
  /**
   * 跨框架环境
   */
  CROSS_FRAMEWORK = 'cross-framework',
  /**
   * iframe环境
   */
  IFRAME = 'iframe',
}

/**
 * 元素隐藏处理结果接口
 */
export interface ElementHideResult {
  /** 隐藏操作类型 */
  operationType: ElementHideOperationType
  /** 是否需要进行 CSS 注入 */
  requiresCssInjection: boolean
  /** CSS 注入操作类型（添加或移除） */
  cssOperation?: ElementHideCssOperation
  /** 注入器类型 */
  injectorType?: InjectorType
  /** 操作是否有效 */
  isValid: boolean
  /** 无效操作的原因 */
  reason: string
}
